package csl.mq.rabbitmq.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @Description: TODO boot配置简单消息
 */
@Configuration
public class NormalMessageConfig {


    /**
     * 创建队列
     */
    @Bean
    public Queue initQueue(){
        return new Queue("hello.queue");
    }

    /**
     * 创建交换机
     */
    @Bean
    public DirectExchange initExchange(){
        return new DirectExchange("hello.exchange");
    }

    @Bean
    public Binding deadLetterExchange(){
        return BindingBuilder.bind(initQueue()).to(initExchange()).with("info"); //路由info
    }
}
